﻿
@using GlobalResources;
@using Microsoft.Azure.IoTSuite.Connectedfactory.WebApp.Models
@using Microsoft.Azure.IoTSuite.Connectedfactory.WebApp.Security

@model OpcSessionModel

<div class="container-fluid browser_connect_container">
    <div class="row browser_connect_header">
        <div class="browser_connect_header_text overflow">@Strings.SupervisorSelect</div>
    </div>
    <div class="row browser_top_container scrollbar-inner">
        <div id="partial" class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
            @{
                Html.RenderPartial("_SupervisorList", Model);
            }
            <div class="row browser_browse_disconnect_button">
                @Html.ActionLink(@Strings.ButtonBack, "Index", "Dashboard", null, new { @class = "btn btn-default btn_browser", @role = "button" })
            </div>
        </div>
        <div id="browserImage" class="browser_image_container  col-xs-12 col-sm-12 col-md-5 col-lg-5">
            <img aria-label="image" class="img-responsive" src="~/Content/img/packing_station.png" />
        </div>
    </div>

    <div id="contextpanel" class="overlay">
        <a aria-label="closePanel" href="#" class="closebtn" onclick="closContextPanel();" role="button"><img aria-label="closePanelIcon" class="dashboard-cancel-icon" src="~/Content/img/cancel.svg" hidden></a>

        <div id="errorContextPanel" class="overlay-content">
            <div class="browser_error_contextpanel_container">
                <span class="browser_error_contextpanel_header">@Strings.BrowserErrorMessage</span>
                <div id="errorHeader" class="browser_error_contextpanel_message"></div>
            </div>
        </div>
    </div>

    <div id="scanContextPanel" class="overlay">
        <div class="overlay-scroll scrollbar-macosx">
            <div class="dashboard_contextpanel_header">
                <div class="dashboard_contextpanel_header_text">@Strings.ScanHeader</div>
            </div>
            <a aria-label="closePanel" href="#" class="closebtn" onclick="$('#scanContextPanel').addClass('overlay-close')"><img aria-label="closePanelIcon" class="dashboard-cancel-icon" src="~/Content/img/cancel.svg"></a>

            <div class="overlay-content list-group">
                <div class="list-group-item text-left list-group-item-heading">
                    <b>@Strings.ScanMessage1</b>
                    <br><b>@Strings.ScanMessage2</b>
                </div>
                <hr />
                <div class="list-group-item text-left">
                    <form class="form-inline" role="form" id="variableWrite">
                        <div class="form-group context-panel-data">
                            <label>
                                @Strings.ScanLabel (
                                <a aria-label="link" style="display:inline" target="_blank" class="dashboard_link" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDR notation</a>
                                )
                            </label><br>
                            <input aria-label="addressRange" id="ipAddressMask" type="text" class="form-control" placeholder="IP-address/netmask">
                            <div id="errorIpRange" hidden>@Strings.InvalidInput</div>
                        </div>
                        <div class="form-group context-panel-data">
                            <label>@Strings.PortRangeLabel</label><br>
                            <input aria-label="portRange" id="portRange" type="text" class="form-control" placeholder="StartPort-EndPort">
                            <div id="errorPortRange" hidden>@Strings.InvalidInput</div>
                        </div>
                        <hr />
                        <div class="node-contextPanel-button-position">
                            <button onclick="apply()" type="button" class="btn btn-default btn_browser_contextpanel">@Strings.FilterApply</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>

<script type="text/javascript">
    $(document).ready(function () {
        jQuery('.scrollbar-macosx').scrollbar();
        // initialize all context panels to default state closed
        $("#contextpanel").addClass("overlay-close").removeClass("overlay-right-open");
        $("#errorContextPanel").addClass("overlay-close").removeClass("overlay-right-open");
        $("#scanContextPanel").addClass("overlay-close").removeClass("overlay-right-open");

        @if (!PermsChecker.HasPermission(Permission.ControlOpcServer))
        {
           @: $(".toggle-state").prop("disabled", true);
           @: $(".toggle").css("background", "gray");
           @: $(".active-bg").css("background", "gray");
           @: $(".indicator").css("background", "darkgray");
           @: $(".label-text").css("color", "gray");
           @: $(".label").css("cursor", "default");
        }
    });

    var title = "@Strings.TitleBrowser";

</script>

